package com.zjitc.chapter05.mapper;

import com.zjitc.chapter05.domain.Worker;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface WorkerMapper {
    @Select("select * from worker where id = #{id}")
    Worker selectWorkerById(Integer id);
    @Insert("insert into worker(name,age,sex) values (#{name},#{age},#{sex})")
    void insertWorker(Worker worker);
    @Update("update worker set name=#{name},age=#{age},sex=#{sex} where id=#{id}")
    void updateWorker(Worker worker);
    @Delete("delete from worker where id=#{id}")
    int deleteWorker(Integer id);
    @Select("select * from worker where name like concat(#{name},'%') and sex=#{sex}")
    List<Worker> selectWorkersByNameAndSex(@Param("name")String name,@Param("sex")String sex);
}

